package com.blackfish.desktop;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class DesktopInterceptor implements Interceptor {
    public void intercept(Invocation inv) {
        Controller clr = inv.getController();
        String isLogin = (String)clr.getSession().getAttribute("UserLoginAction");

        if(isLogin!="Yes"){
            clr.redirect("/desktop/login");
            return;
        }
        System.out.println("Before invoking " + inv.getActionKey());
        inv.invoke();
        System.out.println("After invoking " + inv.getActionKey());

    }
}
